package com.self.test.thread;

public class MyThread extends Thread{
	private String name;
	private int ticket = 5;
	public MyThread(String name) {
		this.name = name;
	}
	
	@Override
	public void run() {
		for (int i = 0; i < 10; i++) {
			if(this.ticket > 0){
				 System.out.println("线程开始："+this.name+",卖票：i="+this.ticket--);
			}
		}
	}
}
